package nuc.soft.xsf.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import net.sf.json.JSONObject;
import nuc.soft.xsf.model.Post;
import nuc.soft.xsf.service.IPostReplyService;
import nuc.soft.xsf.service.IPostSendService;
import nuc.soft.xsf.service.IPostService;
import nuc.soft.xsf.tools.Tools;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;



@Controller
@RequestMapping("/PostController")
public class PostController {
	
	@Resource
	private IPostService postService;
	@Resource
	private IPostSendService postSendService;
	@Resource
	private IPostReplyService postReplyService;

	/**
	 * conditional search
	 * 根据邮件ID查询邮件
	 */
	@RequestMapping(value = "/findByCondition.action", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String searchRecordbyCondition(Post post){	
		//根据邮件ID查询邮件类容
		Map map=Tools.transBean2Map(post);
		List<Post> Listpost= postService.findByCondition(map);
		JSONObject json = new JSONObject();
		json.put("list", Listpost);
		return json.getString("list");
	}

}
